/**
 *  需求相关
 */

import request from '@/utils/request.js';
import { HTTP_REQUEST_URL } from '@/config/index.js';

const api = {}

// 搜索和查询需求列表
api.getList = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/client/need/index',
	data: data,
})

// 添加需求
api.add = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/client/need/add',
	data: data,
})

// 编辑需求
api.edit = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/client/need/edit',
	data: data,
})

// 删除需求
api.delete = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/client/need/del',
	data: data,
})

// 需求详情
api.info = data => request.globalRequest({
	methods: 'POST',
	url: HTTP_REQUEST_URL + '/client/need/info',
	data: data,
})

// 上传图片
api.upload = data => request.uploadFile({
	url: HTTP_REQUEST_URL + '/files/upload',
	filePath: data.filePath,
	name: 'file',
	data: {
		accept: 'image',
		dir: 'need',
		category_id: '7',
		type: 1,
	},
})

export default api